import util from '../../utils/util.js';
import $ from '../../utils/ajax.js';
const app = getApp();
Page({

    data: {
        item: {},
        second: 0,
    },
    onLoad(options) {
        const prime = JSON.parse(options.item);
        this.setData({
            item: prime,
            second: options.second ? Number(options.second) : 0
        })
        
    },
    onTel() {
        wx.makePhoneCall({
            phoneNumber: app.wxApp.tel
        })
    },
    onPullDownRefresh(e) {
        if (this.data.second === 100) return;
        app.agentStatus();
    },
    onRepert() {
        $.p(app.wxApp.url + 'agentnew/regainApply', {
            agent: wx.getStorageSync('agent'),
            tel: wx.getStorageSync('tel'),
        }, app.onStrart, (res) => {
            console.log(res)
            app.agentStatus();
        }, (res) => {
            util.showToast(res.data)
        })

    },
    onQuert() {
        app.quit();
    }
})